import { __private, _decorator, Camera, Component, geometry, Material, Node, Vec4 } from 'cc';
const { ccclass, property } = _decorator;
const tempV4 = new Vec4();

@ccclass('CurvedController')
export class CurvedController extends Component {
    @property(Camera)
    camera: Camera | null = null;

    @property(Material)
    private standard: Material | null = null;
    @property(Material)
    private toon: Material | null = null;
    @property(Material)
    private curved_sprite: Material | null = null;
    @property(Material)
    private curved_spine: Material | null = null;

    @property(Material)
    private curved_builtin_billboard: Material | null = null;



    start() {
        // this.camera.camera.frustum;
        // geometry.Frustum.createOrthographic(this.camera.camera.frustum,720,1600,1,1000,);
    }

    update(deltaTime: number) {
        this.setCameraPos();
    }

    private setCameraPos() {
        tempV4.x = this.camera.node.worldPosition.x;
        tempV4.y = this.camera.node.worldPosition.y;
        tempV4.z = this.camera.node.worldPosition.z;
        
        // tempV4.y += 10;
        // tempV4.z += 20;

        // this.standard.setProperty("_FollowOffset", tempV4);
        // this.toon.setProperty("_FollowOffset", tempV4);
        // this.curved_sprite.setProperty("_FollowOffset", tempV4);
        // this.curved_spine.setProperty("_FollowOffset", tempV4);
        
        // this.curved_builtin_billboard.setProperty("_FollowOffset", tempV4);
    }


}


